package com.itheima.dao;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.ScalarHandler;

import com.itheima.utils.DataSourceUtils;

public class UserDao {

	public int getFlag(String username) throws SQLException {
		QueryRunner qr = new QueryRunner(DataSourceUtils.getDataSource());
		
		String sql = "select count(*) from user where username = ?";
		
		int intValue = ((Long)qr.query(sql, new ScalarHandler(), username)).intValue();
		return intValue;
	}

}
